package com.dream.common.utils;

import java.util.concurrent.*;


public class ThreadPoolService {
    private static final ThreadPoolExecutor THREAD_POOL;

    public ThreadPoolService() {
    }

    public static void execute(Runnable task) {
        THREAD_POOL.submit(task);
    }

    public static <T> Future<T> execute(Callable<T> callable) {
        return THREAD_POOL.submit(callable);
    }

    static {
        THREAD_POOL = new ThreadPoolExecutor(50, 500, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue(10000), new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
